<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width,initial-scale=1.0" />
  <link id="ico" rel="icon" />
  <template id="svg-ico">
    <svg width="32" height="32" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
      <linearGradient id="linear-ico" x1="0%" y1="0%" x2="0%" y2="100%">
        <stop offset="0%" style="stop-color:#00cc00" stop-opacity="1" />
        <stop offset="100%" style="stop-color:#006600" stop-opacity="1" />
      </linearGradient>
      <path fill="url(#linear-ico)"
        d="M105.6 347.2v-232.96C105.6 55.168 153.664 7.04 212.608 7.04h597.12L1024 226.688v441.792h-53.568V280.32h-133.888a78.848 78.848 0 0 1-80.32-80.32V60.672H212.672a53.696 53.696 0 0 0-53.568 53.504v232.96h917.12c29.504 0 53.568 24.128 53.568 53.632v374.848c0 29.44-24.064 53.504-53.568 53.504H159.104v80.32c0 29.44 24.064 53.568 53.568 53.568h704.256c29.44 0 53.504-24.064 53.504-53.568V613.248H1024v296.32c0 58.944-48.128 107.136-107.072 107.136H212.672a107.328 107.328 0 0 1-107.136-107.136v-80.32H54.144a53.696 53.696 0 0 1-53.568-53.568V400.768c0-29.504 24.064-53.568 53.568-53.568h51.392z m236.288 100.928L219.712 768h55.936l29.12-80.192h133.952L467.84 768h56l-122.24-319.872h-59.584z m-21.44 196.672l50.56-140.224h1.856l50.176 140.224H320.32z m234.752-196.672V768h52.352v-122.752h79.36c77.888 0 116.864-33.152 116.864-99.008 0-65.408-38.912-98.112-116.032-98.112H555.136z m52.352 44.8h76.16c22.848 0 39.872 4.032 50.688 12.544 10.752 8.064 16.512 21.504 16.512 40.768s-5.376 33.152-16.128 41.664c-10.752 8.064-27.776 12.544-51.008 12.544h-76.16v-107.52z m241.024-44.8V768h52.48V448.128h-52.48z m-38.784-366.016v117.76c0 13.44 10.688 26.88 26.752 26.88h112.512l-139.264-144.64z" />
    </svg>
  </template>
  <script>
    function c(params) {
      console.log(this);
    }
    (function () {
      var svg = document.querySelector("#svg-ico").innerHTML; //获取svg内容
      document.querySelector("#ico").href = "data:image/svg+xml;base64," + window.btoa(svg); // svg编码成base64;svg内容中有中文:btoa(unescape(encodeURIComponent(svg)))
    })();
  </script>
  <title><%= htmlWebpackPlugin.options.title %></title>
  <!-- <script defer async src="api/session"></script> -->
  <script id="ApiDocScript"></script>
</head>

<body>
  <!-- <svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
      <foreignObject x="20" y="20" width="160" height="160">
        <div xmlns="http://www.w3.org/1999/xhtml"></div>
      </foreignObject>
    </svg> -->
  <!-- <iframe src="/bg2.svg" class="abs" width="100%" height="100%" /> -->
  <!-- <object class="abs" data="bg2.svg" width="100%" height="100%" /> -->
  <div id="app"></div>
</body>

<script>
  // var rect = document.createElement("rect");
  // rect.setAttribute("x", "20");
  // rect.setAttribute("y", "20");
  // rect.setAttribute("width", "10");
  // rect.setAttribute("height", "20");
  // rect.setAttribute("rx", "2");
  // rect.setAttribute("id", "rect1");
  // var svg = document.createElement("svg");
  // svg.setAttribute("xmlns", "http://www.w3.org/2000/svg");
  // svg.setAttribute("width", "100");
  // svg.setAttribute("height", "100");
  // svg.appendChild(rect);
  // document.body.appendChild(svg);
  // rect = document.querySelector("#rect1");
  // console.log(rect);
  function shot(ev) {
    var items = (ev.clipboardData && ev.clipboardData.items) || [];
    var file = null;
    if (items && items.length) {
      for (var i = 0; i <= items.length; i++) {
        var type = items[i].type || "";
        console.log(type);
        if (type.indexOf("image") !== -1) {
          file = items[i].getAsFile();
          break;
        }
      }
    }
    var reader = new FileReader();
    reader.onload = function (e) {
      console.log("", e.target.result);
      var img = new Image();
      img.onload = function () {
        document.body.appendChild(img);
      };
      img.src = e.target.result;
    };
    file && reader.readAsDataURL(file); //此处的file为上面得到的文件对象
  }
  document.addEventListener("keyup", function (ev) {
    // console.log("", ev, ev.clipboardData);
    if (ev.code == "PrintScreen") {
    }
  });
  document.addEventListener("paste", function (ev) {
    // shot(ev);
  });

  function apiDebug(param, config) {
    console.log("[apiDebug][param]", param, config);
    axios.defaults.timeout = 0;
    var apiOption = param.paramSet ? param.paramSet() : param.param || {};
    var option = {
      ...apiOption,
      ...config,
      timeout: 1000
    };
    console.log("[apiDebug][option]", option);
    return app.$ajax(option);
  }
  function apiExport(api, option, callback) {
    console.log("[apiExport]", api);
    let dom = document.querySelector("html");
    let domClone = dom.cloneNode(true);
    domClone.querySelector("#app").innerHTML = "";
    domClone.querySelector("#ApiDocScript").innerHTML = "var apiDoc =" + JSON.stringify(api);
    console.log(domClone.outerHTML);
    var blob = new Blob([domClone.outerHTML], {
      type: "text/html,charset=UTF-8"
    });
    var link = document.createElement("a");
    link.setAttribute("download", "api.html");
    link.href = window.URL.createObjectURL(blob);
    link.click();
    callback && callback();
  }
</script>

</html>